import {IsArray, IsNotEmpty, IsNumber, IsString, ValidateNested} from "class-validator";
import {Type} from "class-transformer";
import {ApiProperty} from "@nestjs/swagger";
import {CreateSurveyQuestionDto} from "./CreateSurveyQuestionDto";

export class CreateSurveyDto {
  @ApiProperty({example: '', description: '主标题'})
  @IsString()
  @IsNotEmpty()
  surveyName: string;

  @ApiProperty({example: '', description: '副标题'})
  @IsString()
  surveySubtitle: string;

  @ApiProperty({type: () => [CreateSurveyQuestionDto], description: '问题项数组'})
  @IsArray()
  @ValidateNested({each: true})
  @Type(() => CreateSurveyQuestionDto)
  questions: CreateSurveyQuestionDto[];
}
